package com.lanswon.qzsmk.controller.inventoryManageController;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.lanswon.qzsmk.annotation.SystemControllerLog;
import com.lanswon.qzsmk.base.DwzPage;
import com.lanswon.qzsmk.service.systemManageService.InventoryManagementService;

import ch.qos.logback.classic.Logger;

@Controller
@RequestMapping(value = "/inventoryMagOfReceiveRejectCardByCenter")
public class InventoryMagOfReceiveRejectCardByCenterController {
	
	private final static Logger logger = (Logger) LoggerFactory.getLogger(InventoryMagOfReceiveRejectCardByCenterController.class);
	
	@Autowired
	InventoryManagementService ims;
	
	/**
	 * 子模块：中心库接废卡上缴入库 
	 * 查询上缴的废卡信息
	 * @return
	 */
	@RequiresPermissions("inventoryMagOfReceiveRejectCardByCenter:index")
	@RequestMapping(name = "废卡上缴接收页面,inventoryMagOfReceiveRejectCardByCenter:index",value = "/queryRejectCardReceiving", method = { RequestMethod.POST, RequestMethod.GET })
	@SystemControllerLog(description = "查询上缴的废卡信息")
	public String queryRejectCardReceiving(HttpServletRequest request) {
		return "RejectCardReceiving";
	}
	
	/**
	 * 子模块：网点接收配送并入库 
	 * 网点接收页面加载
	 * @return
	 */
	@RequiresPermissions("inventoryMagOfReceiveRejectCardByCenter:getRejectCardReceiving")
	@RequestMapping(name = "废卡上缴接收登记,inventoryMagOfReceiveRejectCardByCenter:getRejectCardReceiving",value = "/getRejectCardReceiving", method = RequestMethod.POST)
	@ResponseBody
	@SystemControllerLog(description = "网点接收页面加载")
	public Map<String, Object> getRejectCardReceiving(HttpServletRequest request, Integer pageNum, Integer numPerPage) {
		if (pageNum == null && numPerPage == null) {
			pageNum = 1;
			numPerPage = 10;
		}
		// 接收前画面穿过来数据
		String distributeTaskNo = request.getParameter("rejectDistributeTaskNoByReceiving");
		// 装有画面信息的map
		Map<String, String> map = new HashMap<String, String>();
		map.put("distributeTaskNo", distributeTaskNo);
		DwzPage<Map<String,String>> dpList = ims.getRejectCardReceiving(map, pageNum, numPerPage);
		Map<String, Object> rMap = new HashMap<>();
		rMap.put("list", dpList);
		rMap.put("distributeNo", distributeTaskNo);
		return rMap;
	}
}
